package br.com.vibe.bean;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import br.com.vibe.adapter.AdapterListView;
import br.com.vibe.canonicos.DificuldadeEnum;
import br.com.vibe.canonicos.ItemListDesafiosChild;
import br.com.vibe.canonicos.ItemListDesafiosGroup;

public class DesafioActivity extends Activity {
	/** Called when the activity is first created. */
	
	Context ctx = this;
	MenuItem adicionarMenu;
	RelativeLayout adicionarBar;
	EditText desafio;
	Button addButton;
	SeekBar dificuldadeBar;
	TextView statusDificuldade;
	
	DificuldadeEnum dificuldade = DificuldadeEnum.MEDIO;
	
	ListView listView;
	AdapterListView adapterListView;
	ArrayList<ItemListDesafiosGroup> itens;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.desafios);		
		
		this.adicionarBar = (RelativeLayout) findViewById(R.id.adicionarBar);
		//this.dificuldadeBar = (SeekBar) findViewById(R.id.);
		//this.addButton = (Button) findViewById(R.id.add);
		this.desafio = (EditText) findViewById(R.id.novoDesafio);
		//this.statusDificuldade = (TextView) findViewById(R.id.statusDificuldade);

		this.listView = (ListView) findViewById(R.id.desafiosList);
        
        itens = SetStandardGroups();
        adapterListView = new AdapterListView(this, itens);
        listView.setAdapter(adapterListView);
    }
    
    public ArrayList<ItemListDesafiosGroup> SetStandardGroups() {
    	ArrayList<ItemListDesafiosGroup> list = new ArrayList<ItemListDesafiosGroup>();
    	ArrayList<ItemListDesafiosChild> list2 = new ArrayList<ItemListDesafiosChild>();
        ItemListDesafiosGroup gru1 = new ItemListDesafiosGroup("Sex in School", dificuldade);
        ItemListDesafiosChild ch1_1 = new ItemListDesafiosChild();
        ch1_1.setDescricao("A movie");
        ch1_1.setAutor("Effy");
        
        ch1_1.setDescricao("Have a romantic sex in the school");
        ch1_1.setAutor("Effy");
        list2.add(ch1_1);
        
        gru1.setItems(list2);
        
        list.add(gru1);
        list.add(gru1);
        
        return list;
    }
    
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		//getMenuInflater().inflate(R.menu.options, menu);

		/*
		this.adicionarMenu = (MenuItem) menu.findItem(R.id.item_menu_add);
		this.adicionarMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {

			@Override
			public boolean onMenuItemClick(MenuItem item) {
				adicionarBar.setVisibility(View.VISIBLE);
				return false;
			}
		});
		 */
		return true;
	}
}